import { defineStore } from 'pinia'
import { ref } from "vue";
import type { Ref } from 'vue';

interface RootObject {
  checked: number;
  children: null;
  ico: string | null;
  id: number;
  name: string;
  pid: number;
  postion: null | string;
  sort: number;
  url: string | null;
}

const userStore = defineStore('user', {
  state: () => { 
    const menu: Ref<RootObject[]> = ref([])
    return {
      name:'',
      token:'',
      menu
    }

  },
  getters: {
    
  },
  actions: {

  },
  persist:{ // 自定义持久化方式
    storage: window.sessionStorage,//存储的位置
    paths:[]
  },
})

export default userStore



